import io from 'socket.io-client'
export const socketClient = {
  info: 'https://vux.li',
  color: '#6eb3d5',
  init: function () {
    /* 连接websocket后端服务器 */
    console.log('init')
    this.socket = io.connect('ws://192.168.1.135:3000')
    this.socket.emit('message', { userid: '333', username: '33' })
    let that = this
    this.socket.on('customEmit', function (obj) {
      console.log(obj)
      that.info = obj.info
      that.color = obj.color
    })
  },
  send: function () {
    /* 连接websocket后端服务器 */
    this.socket.emit('message', { userid: '333', username: '33' })
    let that = this
    this.socket.on('customEmit', function (obj) {
      console.log(obj)
      that.info = obj.info
      that.color = obj.color
    })
  }
}

